/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Transformers;

/**
 *
 * @author BeerBrewer
 */
public class BaselineWonder {
    private double a;    
    private double[][] signals;
    private final double b = 0.0015;
    
    public BaselineWonder(){

    }

    public double[][] init(double a2, double[][] signalsIN){
        a = a2;
        signals = new double[signalsIN.length][signalsIN[0].length];
        for (int i =0; i< signalsIN.length; i++){
            for (int j=0; j<signalsIN[0].length; j++){
                if(a*Math.sin(b*j)>0){
                    if (signalsIN[i][j] >0)
                        signals[i][j] = ((a*Math.sin(b*j)) * Math.abs(signalsIN[i][j])) + signalsIN[i][j];
                    else
                        signals[i][j] = signalsIN[i][j] + ((a*Math.sin(b*j)) * Math.abs(signalsIN[i][j]));                    
                }
                else
                {
                    if (signalsIN[i][j] >0)
                        signals[i][j] = signalsIN[i][j] + ((a*Math.sin(b*j)) * Math.abs(signalsIN[i][j]));
                    else
                        signals[i][j] = signalsIN[i][j] +((a*Math.sin(b*j)) * Math.abs(signalsIN[i][j])); 
                }
                //signals[i][j] = (1+(a*Math.sin(b*j))) * signalsIN[i][j];
            }
        }
        return signals;
    }

}
